package com.example.jz.noone.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.jz.noone.R;
import com.example.jz.noone.activity.IssueTextActivity;
import com.example.jz.noone.activity.LoginActivity;
import com.example.jz.noone.activity.MyTextActivity;
import com.example.jz.noone.views.CircleImageView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import me.yokeyword.fragmentation.SupportFragment;

public class FragmentMe extends SupportFragment {
    @BindView(R.id.top_img)
    CircleImageView topImg;
    @BindView(R.id.name)
    TextView name;
    @BindView(R.id.login)
    LinearLayout login;
    Unbinder unbinder;
    @BindView(R.id.issue_text)
    RelativeLayout issueText;
    @BindView(R.id.my_text)
    RelativeLayout myText;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState) {
        View view=LayoutInflater.from( getContext() ).inflate( R.layout.fragment_me,null );
        unbinder=ButterKnife.bind( this,view );
        return view;
    }


    @OnClick({R.id.login,R.id.issue_text,R.id.my_text})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.login:
                Intent intent=new Intent( getActivity(),LoginActivity.class );
                startActivity( intent );
                break;
            case R.id.issue_text:
                Intent intent1=new Intent( getActivity(),IssueTextActivity.class );
                startActivity( intent1 );
                break;
            case R.id.my_text:
                Intent intent2=new Intent( getActivity(),MyTextActivity.class );
                startActivity( intent2 );
                break;
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

}
